TARGET		= test
CC          = g++
SRCS		= $(wildcard *.cpp)
OBJS     	= $(patsubst %.cpp, %.o, $(SRCS))
TMP_DIR		= obj
TARGET_OBJS	= $(addprefix $(TMP_DIR)/, $(OBJS))
CXXFLAG		= -Wall -g -ggdb -pg -Wextra -pipe
INC_PATH	= -I../ 
LIB_PATH	= 
LIBS		= ../libiobase.a -lm -lc -lpthread
DEFINE		= -DLINUX_OS

.PHONY : all clean depend

all : depend $(TARGET)

-include .depend

$(TARGET) : $(TARGET_OBJS)
	$(CC) $(CXXFLAG) -o $@ $^ $(LIB_PATH) $(LIBS)

$(TMP_DIR)/%.o : %.cpp
	$(CC) $(CXXFLAG) $(DEFINE) $(INC_PATH) -c $< -o $@

depend :
	$(CC) -MM $(CXXFLAG) $(INC_PATH) $(SRCS) > .depend
	@-(./replace.sh)

clean:
	@-(rm $(TMP_DIR)/*.o $(TARGET) .depend)

